<template>
  <ve-radar :data="chartData" :extend="extend" :settings="chartSettings"></ve-radar>
</template>

<script>
import {
  mapActions,
  mapGetters
} from 'vuex'
import {
  selectProresult
} from '@/network/home'
  export default {
    props: ["userId"],
    data() {
      this.chartSettings = {
          areaStyle: {
              opacity: 0.7
          }
      }
      this.extend = {
        series: {
        //   label: { show: true, position: "right" },
        //   itemStyle: { color: '#ED6E87', opacity: 0.7 }
        },
        //样式
        textStyle: {
          color: '#000'
        }
      }
      return {
        chartData: {
          columns: [
            "得分","A艺术型","S社会型","E企业型","C传统型","R现实型","I研究型"
          ],
          rows: [
            {"得分":"最低","A艺术型":0,"S社会型":0,"E企业型":0,"C传统型":0,"R现实型":0,"I研究型":0},
            {"得分":"最高","A艺术型":10,"S社会型":10,"E企业型":10,"C传统型":10,"R现实型":10,"I研究型":10},
            {"得分":"你的得分","A艺术型":0,"S社会型":0,"E企业型":0,"C传统型":0,"R现实型":0,"I研究型":0},
          ]
        }
      }
    },
    computed: {
      ...mapGetters([
        'userinfo'
      ]),
    },
    created() {
      this.selectproresult()
    },
    methods: {
      ...mapActions([
        'selectProresult'
      ]),
      selectproresult() {
        let params = {
          user_Id: this.userId,
          questionType_Id: 3
        }
        selectProresult(params)
          .then((data) => {
            // console.log(data.data[0])
            this.chartData.rows[2].A艺术型 = JSON.parse(data.data[0].countScore).A
            this.chartData.rows[2].S社会型 = JSON.parse(data.data[0].countScore).S
            this.chartData.rows[2].E企业型 = JSON.parse(data.data[0].countScore).E
            this.chartData.rows[2].C传统型 = JSON.parse(data.data[0].countScore).C
            this.chartData.rows[2].R现实型 = JSON.parse(data.data[0].countScore).R
            this.chartData.rows[2].I研究型 = JSON.parse(data.data[0].countScore).I
            this.$emit('resultStrengthHLD',data.data[0].resultStrength);
          })
          .catch((err) => {
            // this.$toast(err.msg, 'error')
          })
      },
    }
  }
</script>